package d3_collecction_list;


import java.util.LinkedList;

/**
 * 2024/6/4 队列 CJJ
 */
public class ListTest3 {
    public static void main(String[] args) {

        //入队
        LinkedList<String> linkedList = new LinkedList<>();
        linkedList.addLast("第1");
        linkedList.addLast("第2");
        linkedList.addLast("第3");
        System.out.println(linkedList);

        //出队
        System.out.println(linkedList.removeFirst());
        System.out.println(linkedList.removeFirst());
        System.out.println(linkedList);

        //创建一个栈对象
        LinkedList<String> list = new LinkedList<>();

        //压栈(push)
        list.push("第1颗子弹");
        list.push("第2颗子弹");
        list.push("第3颗子弹");
        System.out.println(list);

        //出栈(pop)
        System.out.println(list.pop());
        System.out.println(list.pop());
        System.out.println(list);

        //栈对象 从下往上出
    }
}
